﻿@using rentit03_client.Models
<table class="table table-striped">
    <thead>
        <tr>
            <th>
                Id
            </th>
            <th>
                Name
            </th>
            <th>
                Email
            </th>
            <th>
                Member since
            </th>
            <th>
                Links
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach (UserObj user in ViewBag.Users)
        {
            <tr>
                <td>
                    @user.Id
                </td>
                <td>
                    @user.Name
                </td>
                <td>
                    @user.Email
                </td>
                <td>
                    <time class="timeago" datetime="@user.Created">@user.Created</time>
                </td>
                <td style="text-align: right">
                    @if (ViewBag.User.Permissions.Contains("ReadUser") || ViewBag.User.Id == user.Id)
                    {
                        <a href="@Url.Action("Index", "User", new { @id = user.Id })" title ="View account">
                            <i class="icon-user"></i></a>
                    }
                    @if (ViewBag.User.Permissions.Contains("EditUser") || ViewBag.User.Id == user.Id)
                    {
                        <a href="@Url.Action("Edit", "User", new { @id = user.Id })" title ="Edit account"><i
                            class="icon-edit"></i></a>
                    }
                    @if (ViewBag.User.Permissions.Contains("DeleteUser") || ViewBag.User.Id == user.Id)
                    {
                        <a href="@Url.Action("Delete", "User", new { @id = user.Id })" title ="Delete account">
                            <i class="icon-trash"></i></a>
                    }
                </td>
            </tr>
        }
    </tbody>
</table>
@Html.Partial("_Pager")